{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b3f122d2-1bce-461a-9fe6-b959a80aa123",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "小球在第10次落地时，共经过299.609375米\n",
      "第10次反弹0.09765625米\n"
     ]
    }
   ],
   "source": [
    "h=100.0;s = h; r=h/2; #第一次。s表示路程之和，r表示反弹距离\n",
    "for i in range(2,11): #第2-10次\n",
    "    s += r*2; r = r / 2\n",
    "print(str.format(\"小球在第10次落地时，共经过{0}米\",s)) \n",
    "print(str.format(\"第10次反弹{0}米\",r))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d6b4acf-a5a2-4bab-95bf-94e0e6790004",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
